#ifndef MESSAGE_QUEUE_H_
#define MESSAGE_QUEUE_H_

#include "env.h"
#include "list.h"

typedef struct mq_t
{
	list l;
	lock_t lock;
	cond_t cond;
} mq;

enum {
    MQ_ERROR = -1,
    MQ_SUCCESS = 0,
    MQ_EMPTY = 1
};

typedef void* mq_message;

int mq_init(mq* mq);

int mq_enqueue(mq* mq, mq_message m);

int mq_dequeue(mq* mq, mq_message* m, int block);

int mq_destroy(mq* mq);

#endif /* MESSAGE_QUEUE_H_ */
